const koa = require("koa");
const cors = require("koa-cors");
// 中间件
const time_middleware = require("./middleware/koa_response_duration");
const header_middleware = require("./middleware/koa_response_header");
const data_middleware = require("./middleware/koa_response_data");
const app = new koa();

app.use(time_middleware);
app.use(header_middleware);
app.use(data_middleware);

app.use(cors());

app.listen(3000, () => {
  console.log("http://localhost:3000");
});

// websocket
const webSocketService = require("./service/web_socket_service");
// 开启服务端监听
webSocketService.listen();
